How to check for no enumerations?

I have an attribute called isInDFMECA that is of Enumeration type, and is multi-valued. How can I check, in an If statement, whether the attribute is empty? I've tried the following but it did not work:

if (null obj."isInDFMECA") {
    displayRich("blank!")
}

On the other hand, if I do this, every single object displays the string even if there are no enumerations checked:

 

if (!null obj."isInDFMECA") {
    displayRich("not blank!")
}

Thanks!

Edit: the above scripts were added to a new column of Layout DXL.


DoanD - Fri Jan 11 16:44:12 EST 2019

Re: How to check for no enumerations?
Mike.Scharnow - Fri Jan 11 17:07:42 EST 2019

 obj."isInDFMECA"    gives you a handle to the attribute. If you want to extract the value of the attribute, cast it to a string e.g. by adding the empty string "" to the handle. So, your code should be

if (null (obj."isInDFMECA" "")) {
    displayRich("blank!")
}

 

Re: How to check for no enumerations?
DoanD - Sat Jan 12 01:40:16 EST 2019

Mike.Scharnow - Fri Jan 11 17:07:42 EST 2019

 obj."isInDFMECA"    gives you a handle to the attribute. If you want to extract the value of the attribute, cast it to a string e.g. by adding the empty string "" to the handle. So, your code should be

if (null (obj."isInDFMECA" "")) {
    displayRich("blank!")
}

 

Perfect, thank you!